Fix insecure exception/response logging in LLMJudgeForLegalSurvey - #2
Open
denis-samatov wants to merge 1 commit into
Open
Fix insecure exception/response logging in LLMJudgeForLegalSurvey#2denis-samatov wants to merge 1 commit into
denis-samatov wants to merge 1 commit into
Conversation
Raw LLM responses and exception objects were being logged directly, which could leak sensitive information (PII, secrets, internal system details) into logs. - Replace generic 'except Exception as e' with a specific exceptions.GoogleAPICallError catch plus a sanitized general except clause. - Remove response.text from JSONDecodeError log messages. - Remove the exception object from all log messages. - Add the google.api_core exceptions import needed for the specific catch. Note: this diff also reformats the notebook's JSON (pretty-printed instead of minified), a side effect of editing it programmatically; the only functional change is the logging fix described above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Raw LLM responses and exception objects were being logged directly in
LLMJudgeForLegalSurvey, which could leak sensitive information (PII, secrets, internal system details) into logs.except Exception as ewith a specificexceptions.GoogleAPICallErrorcatch plus a sanitized general except clauseresponse.textfromJSONDecodeErrorlog messagesgoogle.api_coreexceptions import needed for the specific catchNote: this diff also reformats the notebook's JSON (pretty-printed instead of minified), a side effect of editing it programmatically — the only functional change is the logging fix described above.
Test plan
GoogleAPICallErrorand aJSONDecodeErrorno longer includes raw response text or exception details